@model IEnumerable<ProjectCodeS.Models.User>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Username
        </th>
        <th>
            Password
        </th>
        <th>
            UserEmailAddress
        </th>
        <th>
            DateCreated
        </th>
        <th>
            LastUpdated
        </th>
        <th>
            UserRoles
        </th>
        <th>
            Company
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>
        <td>
			@item.Username
        </td>
        <td>
			@item.Password
        </td>
        <td>
			@item.UserEmailAddress
        </td>
        <td>
			@String.Format("{0:g}", item.DateCreated)
        </td>
        <td>
			@String.Format("{0:g}", item.LastUpdated)
        </td>
        <td>
			@(item.UserRoles == null ? "None" : item.UserRoles.Count.ToString())
        </td>
        <td>
			@(item.Company == null ? "None" : item.Company.Name)
        </td>
    </tr>
}

</table>


